//
//  CornerCollectionViewCell.swift
//  StickyCollectionView
//
//  Created by Bogdan Matveev on 02/02/16.
//  Copyright © 2016 Bogdan Matveev. All rights reserved.
//

import UIKit

class CornerCollectionViewCell: UICollectionViewCell {

    var cityLabel: UILabel!
    var backingView: UIView!
    
    var city: String? {
        didSet {
            cityLabel.text = city
        }
    }
    
    var color: UIColor? {
        didSet {
            backingView.backgroundColor = color
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.backgroundColor = UIColor.purpleColor()
        cityLabel = UILabel()
        cityLabel.frame = CGRectMake(0, 0, ScreenWidth, 100)
        cityLabel.contentMode = UIViewContentMode.ScaleAspectFill
        
        backingView = UIView()
        backingView.frame = CGRectMake(0, 0, ScreenWidth, 100)
        backingView.contentMode = UIViewContentMode.ScaleAspectFill
        backingView.addSubview(cityLabel)
        contentView.addSubview(backingView)
        
        backingView.layer.cornerRadius = 12
        backingView.layer.masksToBounds = true

    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
